package util;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;

import com.example.sports_meet.LoginActivity;

public class Utils {
    public static void clearLoginInfo(Context context) {
        // 清除SharedPreferences中的登录信息
        SharedPreferences sharedPreferences = context.getSharedPreferences("myPrefs", Context.MODE_PRIVATE);

        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.clear();
        editor.apply();


        // 跳转到登录页面
        Intent intent = new Intent(context, LoginActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        context.startActivity(intent);
    }
}
